<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>PID_Study: E:/STM32CubeIDEWorkspace/noRTOS/PID_Study/Drivers/BSP/Src/keyled.c 文件参考</title>
<link rel="icon" href="Doxygen-55px.png" type="image/x-icon" />
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr id="projectrow">
  <td id="projectlogo"><img alt="Logo" src="Doxygen-55px.png"/></td>
  <td id="projectalign">
   <div id="projectname">PID_Study<span id="projectnumber">&#160;v1.0.0</span>
   </div>
   <div id="projectbrief">doc for PID_Study</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','搜索',false);
  $(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">载入中...</div>
<div class="SRStatus" id="Searching">搜索中...</div>
<div class="SRStatus" id="NoMatches">未找到</div>
</div>
</div>
</div>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a href="dir_0c97d201d54b8b5817233953fc3aadb6.html">STM32CubeIDEWorkspace</a></li><li class="navelem"><a href="dir_f3310f12da31771255acec658cd4246d.html">noRTOS</a></li><li class="navelem"><a href="dir_8022218a35d1971722714ae72b00e870.html">PID_Study</a></li><li class="navelem"><a href="dir_17bc370c857333bc4166d76f67bb735c.html">Drivers</a></li><li class="navelem"><a href="dir_b62ba9d628590829d5c152676ba50098.html">BSP</a></li><li class="navelem"><a href="dir_bab04917f1153241c6215d3bf287327d.html">Src</a></li>  </ul>
</div>
</div><!-- top -->
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#func-members">函数</a> &#124;
<a href="#var-members">变量</a>  </div>
  <div class="headertitle"><div class="title">keyled.c 文件参考</div></div>
</div><!--header-->
<div class="contents">

<p>按键与LED驱动实现  
<a href="#details">更多...</a></p>
<div class="textblock"><code>#include &quot;<a class="el" href="keyled_8h_source.html">keyled.h</a>&quot;</code><br />
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
函数</h2></td></tr>
<tr class="memitem:a163c33d782903dc5b144a6ece1765bf8" id="r_a163c33d782903dc5b144a6ece1765bf8"><td class="memItemLeft" align="right" valign="top">uint8_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a163c33d782903dc5b144a6ece1765bf8">Key_Register</a> (GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, uint32_t KeyMask, void(*KeyAction)(void))</td></tr>
<tr class="memdesc:a163c33d782903dc5b144a6ece1765bf8"><td class="mdescLeft">&#160;</td><td class="mdescRight">按键注册  <br /></td></tr>
<tr class="memitem:aa7d9c3619b2df9e030b13e1cb18edad0" id="r_aa7d9c3619b2df9e030b13e1cb18edad0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa7d9c3619b2df9e030b13e1cb18edad0">ReadOneKey_block</a> (<a class="el" href="struct_k_e_y.html">KEY</a> key)</td></tr>
<tr class="memdesc:aa7d9c3619b2df9e030b13e1cb18edad0"><td class="mdescLeft">&#160;</td><td class="mdescRight">阻塞读取某一按键值  <br /></td></tr>
<tr class="memitem:a726ac7d6b0f3fe5a3754e954a17a2e61" id="r_a726ac7d6b0f3fe5a3754e954a17a2e61"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a726ac7d6b0f3fe5a3754e954a17a2e61">Key_Read_block</a> (void)</td></tr>
<tr class="memdesc:a726ac7d6b0f3fe5a3754e954a17a2e61"><td class="mdescLeft">&#160;</td><td class="mdescRight">阻塞读取所有按键值  <br /></td></tr>
<tr class="memitem:ad42fb9ae531cdf757d1e6b7138611068" id="r_ad42fb9ae531cdf757d1e6b7138611068"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ad42fb9ae531cdf757d1e6b7138611068">Key_Read_unblock</a> (uint32_t division)</td></tr>
<tr class="memdesc:ad42fb9ae531cdf757d1e6b7138611068"><td class="mdescLeft">&#160;</td><td class="mdescRight">非阻塞式按键扫描  <br /></td></tr>
<tr class="memitem:a932200eb589077d9d88b9b8bcff5fac8" id="r_a932200eb589077d9d88b9b8bcff5fac8"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a932200eb589077d9d88b9b8bcff5fac8">Key_Flag_Receive</a> (void)</td></tr>
<tr class="memdesc:a932200eb589077d9d88b9b8bcff5fac8"><td class="mdescLeft">&#160;</td><td class="mdescRight">读取按键值并清零  <br /></td></tr>
<tr class="memitem:afa4846032f413dbd897fb0a2317df759" id="r_afa4846032f413dbd897fb0a2317df759"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#afa4846032f413dbd897fb0a2317df759">Key_Flag_Action</a> (uint32_t KeyFlag)</td></tr>
<tr class="memdesc:afa4846032f413dbd897fb0a2317df759"><td class="mdescLeft">&#160;</td><td class="mdescRight">按键单击处理，使用回调函数  <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-var-members" class="groupheader"><a id="var-members" name="var-members"></a>
变量</h2></td></tr>
<tr class="memitem:ab952e65aea7702f5db0701fc88467e6a" id="r_ab952e65aea7702f5db0701fc88467e6a"><td class="memItemLeft" align="right" valign="top"><a id="ab952e65aea7702f5db0701fc88467e6a" name="ab952e65aea7702f5db0701fc88467e6a"></a>
<a class="el" href="struct_k_e_y.html">KEY</a>&#160;</td><td class="memItemRight" valign="bottom"><b>KEYS</b> [<a class="el" href="keyled_8h.html#ace9ae71c88b36af9d91a3d3d6d7bd5db">KEYNUMMER</a>] = {0}</td></tr>
<tr class="memitem:a876bc7153a02126f43a9aeb5a676326b" id="r_a876bc7153a02126f43a9aeb5a676326b"><td class="memItemLeft" align="right" valign="top"><a id="a876bc7153a02126f43a9aeb5a676326b" name="a876bc7153a02126f43a9aeb5a676326b"></a>
uint8_t&#160;</td><td class="memItemRight" valign="bottom"><b>keyused</b> = 0</td></tr>
<tr class="memitem:a29e475ffa051824a3329b732236d3f70" id="r_a29e475ffa051824a3329b732236d3f70"><td class="memItemLeft" align="right" valign="top"><a id="a29e475ffa051824a3329b732236d3f70" name="a29e475ffa051824a3329b732236d3f70"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>KeyFlag</b> = 0x0000</td></tr>
<tr class="memitem:a94335fd129a898ce29e8553f277f3b1c" id="r_a94335fd129a898ce29e8553f277f3b1c"><td class="memItemLeft" align="right" valign="top"><a id="a94335fd129a898ce29e8553f277f3b1c" name="a94335fd129a898ce29e8553f277f3b1c"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>LastKeysValue</b> = 0</td></tr>
<tr class="memitem:a5af0a18092af6821c3a64f1e7f3323eb" id="r_a5af0a18092af6821c3a64f1e7f3323eb"><td class="memItemLeft" align="right" valign="top"><a id="a5af0a18092af6821c3a64f1e7f3323eb" name="a5af0a18092af6821c3a64f1e7f3323eb"></a>
uint32_t&#160;</td><td class="memItemRight" valign="bottom"><b>CurKeysValue</b> = 0</td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">详细描述</h2>
<div class="textblock"><p>按键与LED驱动实现 </p>
<dl class="section author"><dt>作者</dt><dd>废话文学创始人 </dd></dl>
<dl class="section version"><dt>版本</dt><dd>1.0 </dd></dl>
<dl class="section date"><dt>日期</dt><dd>2024-02-25 </dd></dl>
</div><a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">函数说明</h2>
<a id="afa4846032f413dbd897fb0a2317df759" name="afa4846032f413dbd897fb0a2317df759"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afa4846032f413dbd897fb0a2317df759">&#9670;&#160;</a></span>Key_Flag_Action()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Key_Flag_Action </td>
          <td>(</td>
          <td class="paramtype">uint32_t</td>          <td class="paramname"><span class="paramname"><em>KeyFlag</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>按键单击处理，使用回调函数 </p>
<p>按键标志位动作处理</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">KeyFlag</td><td>按键标志位 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a932200eb589077d9d88b9b8bcff5fac8" name="a932200eb589077d9d88b9b8bcff5fac8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a932200eb589077d9d88b9b8bcff5fac8">&#9670;&#160;</a></span>Key_Flag_Receive()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Key_Flag_Receive </td>
          <td>(</td>
          <td class="paramtype">void</td>          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>读取按键值并清零 </p>
<p>获取按键标志位</p>
<dl class="section return"><dt>返回</dt><dd>当前按键标志位 </dd></dl>

</div>
</div>
<a id="a726ac7d6b0f3fe5a3754e954a17a2e61" name="a726ac7d6b0f3fe5a3754e954a17a2e61"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a726ac7d6b0f3fe5a3754e954a17a2e61">&#9670;&#160;</a></span>Key_Read_block()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Key_Read_block </td>
          <td>(</td>
          <td class="paramtype">void</td>          <td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>阻塞读取所有按键值 </p>
<p>阻塞方式读取按键</p>
<dl class="section note"><dt>注解</dt><dd>标志存入KeyFlag </dd></dl>

</div>
</div>
<a id="ad42fb9ae531cdf757d1e6b7138611068" name="ad42fb9ae531cdf757d1e6b7138611068"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad42fb9ae531cdf757d1e6b7138611068">&#9670;&#160;</a></span>Key_Read_unblock()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Key_Read_unblock </td>
          <td>(</td>
          <td class="paramtype">uint32_t</td>          <td class="paramname"><span class="paramname"><em>division</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>非阻塞式按键扫描 </p>
<p>非阻塞方式读取按键</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">division</td><td>控制函数的实际执行次数 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>注解</dt><dd>标志存入KeyFlag </dd>
<dd>
无滤波算法，当实际扫描间隔大于20ms即可去抖 </dd>
<dd>
建议扫描时间在20ms~100ms内 </dd></dl>

</div>
</div>
<a id="a163c33d782903dc5b144a6ece1765bf8" name="a163c33d782903dc5b144a6ece1765bf8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a163c33d782903dc5b144a6ece1765bf8">&#9670;&#160;</a></span>Key_Register()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint8_t Key_Register </td>
          <td>(</td>
          <td class="paramtype">GPIO_TypeDef *</td>          <td class="paramname"><span class="paramname"><em>GPIOx</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint16_t</td>          <td class="paramname"><span class="paramname"><em>GPIO_Pin</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t</td>          <td class="paramname"><span class="paramname"><em>KeyMask</em></span>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*</td>          <td class="paramname"><span class="paramname"><em>KeyAction&#160;</em></span>)(void)&#160;)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>按键注册 </p>
<p>注册按键</p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">GPIOx</td><td>按键对应端口 </td></tr>
    <tr><td class="paramname">GPIO_Pin</td><td>按键对应管脚 </td></tr>
    <tr><td class="paramname">KeyMask</td><td>按键掩码，详见keyled.h </td></tr>
    <tr><td class="paramname">KeyAction</td><td>按键单击的回调函数 </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>返回</dt><dd>注册结果，0为失败，1为成功 </dd></dl>

</div>
</div>
<a id="aa7d9c3619b2df9e030b13e1cb18edad0" name="aa7d9c3619b2df9e030b13e1cb18edad0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa7d9c3619b2df9e030b13e1cb18edad0">&#9670;&#160;</a></span>ReadOneKey_block()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ReadOneKey_block </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="struct_k_e_y.html">KEY</a></td>          <td class="paramname"><span class="paramname"><em>key</em></span></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>阻塞读取某一按键值 </p>
<dl class="params"><dt>参数</dt><dd>
  <table class="params">
    <tr><td class="paramname">key</td><td>按键结构体 </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0
</small></address>
</div><!-- doc-content -->
</body>
</html>
